import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PubToolScreenVO, PubToolScreenForm, PubToolScreenQuery,screenInfoVO } from '@/api/manu/pubToolScreen/types';

/**
 * 查询车间屏幕管理单列表
 * @param query
 * @returns {*}
 */

export const listPubToolScreen = (query?: PubToolScreenQuery): AxiosPromise<PubToolScreenVO[]> => {
  return request({
    url: '/manu/pubToolScreen/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询车间屏幕管理单详细
 * @param id
 */
export const getPubToolScreen = (id: string | number): AxiosPromise<PubToolScreenVO> => {
  return request({
    url: '/manu/pubToolScreen/' + id,
    method: 'get'
  });
};

/**
 * 新增车间屏幕管理单
 * @param data
 */
export const addPubToolScreen = (data: PubToolScreenForm) => {
  return request({
    url: '/manu/pubToolScreen',
    method: 'post',
    data: data
  });
};

/**
 * 修改车间屏幕管理单
 * @param data
 */
export const updatePubToolScreen = (data: PubToolScreenForm) => {
  return request({
    url: '/manu/pubToolScreen',
    method: 'put',
    data: data
  });
};

/**
 * 删除车间屏幕管理单
 * @param id
 */
export const delPubToolScreen = (id: string | number | Array<string | number>) => {
  return request({
    url: '/manu/pubToolScreen/' + id,
    method: 'delete'
  });
};

/**
 * 屏幕端获取屏幕要展示的内容
 * @param id
 */
export const getScreenByScreenId = (id: string | number): AxiosPromise<screenInfoVO> => {
  return request({
    url: '/manu/pubToolScreen/screenInfoById/' + id,
    method: 'get'
  });
}
